package com.yuan.java.cssbox;

import org.fit.cssbox.demo.ImageRenderer;
import org.junit.Test;

import java.awt.*;
import java.io.File;
import java.io.FileOutputStream;

/**
 * @author yuaneg 2019/2/23
 */
public class CssDemo {

    @Test
    public void cssTest() {
        ImageRenderer render = new ImageRenderer();
        render.setWindowSize(new Dimension(10240, 5400), false);
        String url = "https://blog.csdn.net/ran0914/article/details/81356122";
        File file;
        byte[] data = null;

        try {
            //创建一个临时文
            file = new File("1.png");
            //将html转为png
            FileOutputStream out = new FileOutputStream(file);
            render.renderURL(url, out, ImageRenderer.Type.PNG);

        } catch (Exception e) {
            e.printStackTrace();
        }

    }

}
